package com.example.user.controller;

import com.example.common.entity.ResultDO;
import com.example.common.User;
import com.example.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @program: microservice
 * @description: 用户
 * @author: meihua
 * @created: 2020/11/16 14:38
 */
@RequestMapping("/user")
@Controller
public class UserController {


    @Autowired
    private UserService userService;

    @ResponseBody
    @RequestMapping(value = "/info",method = RequestMethod.POST)
    public ResultDO<User> getUserInfo(@RequestParam Integer id){
        return new ResultDO<User>(userService.getUser(id));
    }

    @ResponseBody
    @RequestMapping(value = "/login",method = RequestMethod.POST)
    public ResultDO<User> getUserInfo(@RequestParam String name,@RequestParam String passWord ){
        return userService.login(name,passWord);
    }

}
